#include "../../afwApp.h"

#include <gtk/gtk.h>
#include <assert.h>

using namespace one_rag::App::impl;

Gtk2Window::Gtk2Window():_widget(0)
{
}

Gtk2Window::~Gtk2Window()
{
}

bool Gtk2Window::Create(const char* name, ePositionType pos, int w, int h)
{
  assert(!_widget);
  _widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);

  if(!_widget)
    return false;

  if(name)
    gtk_window_set_title(GTK_WINDOW(_widget),name);

  if(w != -1)
    gtk_window_set_default_size(GTK_WINDOW(_widget),w,h);

  if(pos)
  {
    GtkWindowPosition gpos = GTK_WIN_POS_NONE;
    switch(pos){
      default:
      case windowPosDefault:
      gpos = GTK_WIN_POS_NONE; break;
      case windowPosCenter:
      gpos = GTK_WIN_POS_CENTER; break;
    }
    gtk_window_set_position(GTK_WINDOW(_widget),gpos);
  }

  gtk_widget_show(_widget);

  return true;
}
